package com.uzai.console.dto.tiktok.devicetiktokinfo;

import com.uzai.console.common.utils.DateUtil;
import com.uzai.console.dto.QueryParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
 * @author liuqi
 * @date 2021年08月28日 19:52
 */
@ApiModel("抖音设备信息分页查询参数")
@Data
public class DeviceTiktokInfoQuery extends QueryParam {

    @ApiModelProperty("分组id")
    private Long groupId;

    @ApiModelProperty("分组id列表")
    private List<Long> groupIdList;

    @ApiModelProperty("移动端状态（0-手机离线；1-手机在线）")
    private Integer mobileStatus;

    @ApiModelProperty(value = "配置方案id")
    private Long configId;

    @ApiModelProperty("到期类型(0-查询已经到期；1-查询未到期；2-查询即将到期（7天内)；3-查询即将到期（15天内)；4-查询即将到期（30天内)")
    private Integer expireType;

    @ApiModelProperty("查询开始到期时间")
    private Integer expireTimeStart;

    @ApiModelProperty("查询开始到期时间")
    private Integer expireTimeEnd;

    @ApiModelProperty("机器人主键id")
    private Long id;

    @ApiModelProperty("机器人ID列表")
    private List<Long> idList;

    @ApiModelProperty("机器人微信id")
    private String deviceId;

    @ApiModelProperty("机器人微信ID列表")
    private List<String> deviceIdList;

    @ApiModelProperty("机器人微信昵称")
    private String deviceName;

    @ApiModelProperty("机器人微信备注")
    private String deviceRemark;

    @ApiModelProperty("产品编码")
    private String productCode;

    public Integer getExpireTimeStart() {
        if(expireType != null) {
            if (expireTimeStart == null) {
                expireTimeStart = DateUtil.getNowTime();
            }
        }
        return expireTimeStart;
    }

    public void setExpireTimeStart(Integer expireTimeStart) {
        this.expireTimeStart = expireTimeStart;
    }

    public Integer getExpireTimeEnd() {
        if(expireType != null){
            if(expireType.intValue() == 0){
                expireTimeEnd = getExpireTimeStart();
            }else if(expireType.intValue() == 1){
                expireTimeEnd = getExpireTimeStart();
            }else if (expireType.intValue() == 2){
                expireTimeEnd = getExpireTimeStart() + 604800;
            }else if (expireType.intValue() == 3){
                expireTimeEnd = getExpireTimeStart() + 1296000;
            }else if (expireType.intValue() == 4){
                expireTimeEnd = getExpireTimeStart() + 2592000;
            }
        }
        return expireTimeEnd;
    }

    public void setExpireTimeEnd(Integer expireTimeEnd) {
        this.expireTimeEnd = expireTimeEnd;
    }



}
